import request from '@/utils/request'

// 获取配置文件列表
export function configLists() {
  return request({
    url: `/moon/file/list.svc`,
    method: 'GET'
  })
}

// 获取一个配置文件
export function configGetSingleFile(name) {
  return request({
    url: `/moon/file/get.svc?name=${name}`,
    method: 'GET'
  })
}

// 新增
export function insertConfig(data, name) {
  return request({
    url: `/moon/file/insert.svc?name=${name}`,
    method: 'POST',
    headers: {
      'content-type': 'text/plain; chartset=utf-8'
    },
    data
  })
}

// 更新
export function updateConfig(data, name) {
  return request({
    url: `/moon/file/update.svc?name=${name}`,
    method: 'PUT',
    headers: {
      'content-type': 'text/plain; chartset=utf-8'
    },
    data
  })
}

// 删除
export function configDelete(name) {
  return request({
    url: `/moon/file/delete.svc?name=${name}`,
    method: 'DELETE'
  })
}
